﻿using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using JTLeigh.Commerce.Spencer.Features.ProductImages.Common.Entities;
using JTLeigh.Commerce.Spencer.Features.ProductImages.Business.Caches;

namespace JTLeigh.Commerce.Spencer.Features.ProductImages.Business.UnitTests.Caches
{

	/// <summary>
	/// Unit tests for the <see cref="NullProductImageCache"/> class.
	/// </summary>
	[TestClass]
	public class NullProductImageCacheFixture
	{

		#region Fields

		private static Guid TestTenantId = Guid.NewGuid();
        private const string TestCatalogId = "BaseCatalog";
        private const string TestProductId = "123";

		#endregion // Fields

		#region Methods

		#region ProductImages

		/// <summary>
		/// Ensures <see cref="NullProductImageCache.GetProductImages"/> always returns <see langword="null"/> 
		/// regardless of whether images have been added to the cache via <see cref="NullProductImageCache.SetProductImages"/>.
		/// </summary>
		[TestMethod]
		public void TestGetSetProductImages()
		{
			NullProductImageCache cache;
			Dictionary<Guid, ProductImage> images;

			cache = new NullProductImageCache();
			Assert.IsNull(cache.GetProductImages(TestTenantId, TestCatalogId, TestProductId));

			images = new Dictionary<Guid, ProductImage>();
			images.Add(Guid.NewGuid(), new ProductImage());
			images.Add(Guid.NewGuid(), new ProductImage());
			images.Add(Guid.NewGuid(), new ProductImage());
			cache.SetProductImages(TestTenantId, TestCatalogId, TestProductId, images);
			Assert.IsNull(cache.GetProductImages(TestTenantId, TestCatalogId, TestProductId));
		}

		#endregion // ProductImages

		#endregion // Methods

	}

}
